package com.ccys.doctor.controller;

import com.ccys.common.vo.ResponseResultApp;
import com.ccys.db.dto.doctor.cancelConsult.CancelBookingAppointmentDto;
import com.ccys.db.dto.doctor.cancelConsult.CancelConsultationDto;
import com.ccys.db.dto.doctor.cancelConsult.CancelOfflineConsultationDto;
import com.ccys.db.dto.doctor.cancelConsult.SkipConsultationDto;
import com.ccys.doctor.service.CancelConsultService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.text.ParseException;

/**
 * @program: WhiteCoat
 * @description: 取消咨询相关接口
 * @author: ZhangJingCan
 * @create: 2024-02-05 13:14
 **/

@RestController
@Api(tags = "取消咨询相关接口")
@RequestMapping("cancelConsult")
public class CancelConsultController {

    @Autowired
    private CancelConsultService cancelConsultService;

    /**
     * 触发动作为：此API用于医生取消预约。（应用程序中的“跳过患者”按钮）
     * @param dto bookingId的接收类
     * @return
     */
    @ApiOperation("取消预约")
    @PostMapping(value = "/CancelBookingAppointment")
    public ResponseResultApp cancelBookingAppointment(@RequestBody CancelBookingAppointmentDto dto) {
        return cancelConsultService.cancelBookingAppointment(dto);
    }

    /**
     * 触发动作为：如果患者断开连接（可能患者没有接听电话或患者失去互联网），医生应等待患者2分钟（预约时间为6分钟）。如果超时，医生可以点击“取消会诊”按钮。
     * @return
     */
    @ApiOperation("取消咨询")
    @PostMapping(value = "/CancelConsultation")
    public ResponseResultApp cancelConsultation(CancelConsultationDto dto) throws ParseException {
        return cancelConsultService.cancelConsultation(dto);
    }

    @ApiOperation("取消离线问诊")
    @PostMapping(value = "/CancelOfflineConsultation")
    public ResponseResultApp cancelOfflineConsultation(CancelOfflineConsultationDto dto) {
        return cancelConsultService.cancelOfflineConsultation(dto);
    }

    @ApiOperation("跳过本次问诊")
    @PostMapping(value = "/SkipConsultation")
    public ResponseResultApp skipConsultation(SkipConsultationDto dto) {
        return cancelConsultService.skipConsultation(dto);
    }

}
